package com.hp.team.bookstore.model.profile;

import java.util.Calendar;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "CUSTOMER")
public class Customer extends Profile {

	@Temporal(TemporalType.DATE)
	@Column(name = "BIRTH_DATE")
	private Calendar birthDate;

	@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy="customer")
	private Set<CreditCard> creditCards;

	public void setBirthDate(Calendar birthDate) {
		this.birthDate = birthDate;
	}

	public void setCreditCards(Set<CreditCard> creditCards) {
		this.creditCards = creditCards;
	}

	public Calendar getBirthDate() {
		return birthDate;
	}

	public Set<CreditCard> getCreditCards() {
		return creditCards;
	}
}
